package com.flipkart.action.placeorder;

import java.util.ArrayList;

import com.flipkart.model.placeorder.ShippingAddress;
import com.flipkart.model.placeorder.ShippingAddressModel;
import com.opensymphony.xwork2.ActionSupport;

public class PlaceOrderAction extends ActionSupport {

	private String emailID;
	private ArrayList<ShippingAddress> addressList;
	
	public String getEmailID() {
		return emailID;
	}

	public void setEmailID(String emailID) {
		this.emailID = emailID;
	}
	
	public ArrayList<ShippingAddress> getAddressList() {
		return addressList;
	}

	public void setAddressList(ArrayList<ShippingAddress> addressList) {
		this.addressList = addressList;
	}

	
	/**********************************************************
	 * This method is used to fetch email address of the
	 * registered user and display the email login tab of
	 * Place Order module.
	 **********************************************************/
	public String fetchEmailID() {
		emailID = "avipsa.nayak@gmail.com";
		
		return SUCCESS;
	}
	
	/**********************************************************
	 * This method is used to fetch the list of all shipping
	 * addresses of the registered user and display the shipping
	 * address tab of the Place Order module.
	 **********************************************************/
	public String fetchShippingAddr() {
		int uid = 1;
		addressList = new ArrayList<ShippingAddress>();
		
		addressList = ShippingAddressModel.fetchAddrList(uid);
		
		return SUCCESS;
	}
}
